<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <style type="text/css">

        * {
            margin: 0;
            padding: 0;
        }
        body {
            display: block;
            margin: 0px 0px;
            padding: 0px 0px;
        }

        #app {
            display: block;
        }

        #search {
            height: 80px;
            margin: 0 auto;
            width: 546px;
        }

        #data {
            height: 200px;
            background-color: red;
        }

        .search-m .form {
            position: absolute;
            /*left: 100px;*/
            top: 400px;
            width: 546px;
            height: 32px;
            border: 2px solid #e2231a;
            background: #fff;
        }

        .text{
            left: 0;
            padding: 2px 44px 2px 17px;
            width: 425px;
            height: 26px;
            border: 1px solid transparent;
            line-height: 26px;
            font-size: 12px;
        }

        .search-m .button {
            border-radius: 0;
            right: 0;
            width: 58px;
            height: 32px;
            line-height: 32px;
            border: none;
            background-color: #e1251b;
            font-size: 20px;
            font-weight: 700;
            color: #fff;
            -webkit-transition: background .2s ease;
            transition: background .2s ease;
        }

        .search-m .button, .search-m .text {
            position: absolute;
            top: 0;
            outline: none;
        }

        .search-m .button {
            border-radius: 0;
            right: 0;
            width: 58px;
            height: 32px;
            line-height: 32px;
            border: none;
            background-color: #f25b53;
            font-size: 20px;
            font-weight: 700;
            color: #fff;
            -webkit-transition: background .2s ease;
            transition: background .2s ease;
        }

        .button:hover{
            cursor:pointer;
            background-color: #f70c00;

        }


    </style>
</head>
<body>
<div id="app">
    <div id="search" class="search-m">
        <div class="form" role="serachbox">
            <input type="text" id="key" class="text" />
            <button class="button" label="搜索" onclick="">搜索</button>
        </div>
    </div>

</div>
<script th:src="@{/jquery.min.js}"></script>
<script type="application/javascript">
    $("button").click(function () {
        let question = $("#key").val();
        window.location.href="/search?q=" + question;
    });
    $(document).keydown(function (event) {
        if (event.keyCode == 13) {
            let question = $("#key").val();
            window.location.href="/search?q=" + question;
        }
    });
</script>
</body>
</html>